﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace DefeatEpidemic.Migrations
{
    public partial class AddCheckRecord : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "checkRecord",
                columns: table => new
                {
                    id = table.Column<Guid>(nullable: false),
                    applicationid = table.Column<Guid>(nullable: true),
                    checkerid = table.Column<Guid>(nullable: true),
                    created_at = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_checkRecord", x => x.id);
                    table.ForeignKey(
                        name: "FK_checkRecord_Applications_applicationid",
                        column: x => x.applicationid,
                        principalTable: "Applications",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_checkRecord_Members_checkerid",
                        column: x => x.checkerid,
                        principalTable: "Members",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_checkRecord_applicationid",
                table: "checkRecord",
                column: "applicationid");

            migrationBuilder.CreateIndex(
                name: "IX_checkRecord_checkerid",
                table: "checkRecord",
                column: "checkerid");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "checkRecord");
        }
    }
}
